<?php
namespace BP\DTS;
require_once("BP/DA/DBUrlType.php");
require_once("BP/DA/Log.php");
require_once("BP/En/Attr.php");
require_once("BP/En/ClassFactory.php");
require_once("BP/En/Entity.php");
require_once("BP/En/Map.php");
class AddEmpLeng extends DataIOEn {
	public static function constructor__ () 
	{
		$me = new self();
		$me->HisDoType = DoType::$UnName;
		$me->Title = "为操作员编号长度生级";
		$me->HisRunTimeType = RunTimeType::$UnName;
		$me->FromDBUrl = $DBUrlType->AppCenterDSN;
		$me->ToDBUrl = $DBUrlType->AppCenterDSN;
		return $me;
	}
	public function Do () 
	{
		$sql = "";
		$sql2 = "";
		$al = $ClassFactory->GetObjects("BP.En.Entity");
		foreach ($al as $obj) 		{
			$en = (( (($obj instanceof Entity)) ? $obj : NULL ));
			$map = $en->getEnMap();
			try 
			{
				if ($map->getIsView())
				{
					continue;
				}
			}
			catch (\Exception $e)
			{ /* empty */ }
			$table = $en->getEnMap()->getPhysicsTable();
			foreach ($map->getAttrs() as $attr) 			{
				if (($attr->getKey()->indexOf("Text") != -1))
				{
					continue;
				}
				if ((($attr->getKey()->equals("Rec") || $attr->getKey()->equals("FK_Emp")) || $attr->getUIBindKey()->equals("BP.Port.Emps")))
				{
					$sql += (((((((("\n update " . $table) . " set ") . $attr->getKey()) . "='01'||") . $attr->getKey()) . " WHERE length(") . $attr->getKey()) . ")=6;");
				}
				else
					if ($attr->getKey()->equals("Checker"))
					{
						$sql2 += (((((((("\n update " . $table) . " set ") . $attr->getKey()) . "='01'||") . $attr->getKey()) . " WHERE length(") . $attr->getKey()) . ")=6;");
					}
			}
		}
		$Log->DebugWriteInfo($sql);
		$Log->DebugWriteInfo(("===========================" . $sql2));
	}
}
?>
